package com.woniuxy.yoga.coach.web.controller;


import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.yoga.coach.model.form.QueryLoginLogForm;
import com.woniuxy.yoga.coach.model.param.QueryLoginLogParam;
import com.woniuxy.yoga.coach.service.service.CoachLogService;
import com.woniuxy.yoga.commons.core.model.PageInfo;
import com.woniuxy.yoga.commons.core.model.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 教练日志表 前端控制器
 * </p>
 *
 * @author 韦用文,刘存益,郎腾霄
 * @since 2023年11月28日
 */
@RestController
@RequestMapping("/coachLog")
@Api(tags = "教练登录日志相关业务接口")
@Validated
public class CoachLogController {

    @Autowired
    private CoachLogService coachLogService;

    /**
     * 教练登录日志
     * @param queryLoginLogForm
     * @return
     */
    @PostMapping("/queryLoginLog.api")
    @ApiOperation("教练登录日志接口")
    public Result<PageInfo> queryLoginLog(@Valid @RequestBody QueryLoginLogForm queryLoginLogForm){
        PageInfo pageInfo = coachLogService.queryLoginLog(BeanUtil.toBean(queryLoginLogForm, QueryLoginLogParam.class));
        return Result.getResult(PageInfo.class).setMessage("查询教练登录日志信息成功").setData(pageInfo);
    }
}

